﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace PAI.Web
{
    /// <summary>
    /// Summary description for WebService_wyszukaj_pacjenta
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class WebService_wyszukaj_pacjenta : System.Web.Services.WebService
    {

        [WebMethod]
        public List<Pacjent_PAI> Szukaj_pacjenta_pesel(string pesel)
        {
            using (LINQTOSQLDataContext db = new LINQTOSQLDataContext())
            {
                var records = from record in db.Pacjent_PAIs
                              where record.Pesel == pesel
                              select record;
                return records.ToList();
            }
        }

        [WebMethod]
        public List<Pacjent_PAI> Szukaj_pacjenta_nazwisko(string nazwisko)
        {
            using (LINQTOSQLDataContext db = new LINQTOSQLDataContext())
            {
                var records = from record in db.Pacjent_PAIs
                              where record.Nazwisko == nazwisko
                              select record;
                return records.ToList();
            }
        }
        [WebMethod]
        public List<Pacjent_PAI> Szukaj_pacjenta_miasto(string miasto)
        {
            using (LINQTOSQLDataContext db = new LINQTOSQLDataContext())
            {
                var records = from record in db.Pacjent_PAIs
                              where record.Miasto == miasto
                              select record;
                return records.ToList();
            }
        }
       [WebMethod]
        public List<Pacjent_PAI> Szukaj_pacjenta_kod_pocztowy(string kod_pocztowy)
        {
            using (LINQTOSQLDataContext db = new LINQTOSQLDataContext())
            {
                var records = from record in db.Pacjent_PAIs
                              where record.Kod_pocztowy == kod_pocztowy
                              select record;
                return records.ToList();
            }
        }

       [WebMethod]
       public List<Pacjent_PAI> Szukaj_pacjenta_nr_telefonu(string nr_telefonu)
        {
            using (LINQTOSQLDataContext db = new LINQTOSQLDataContext())
            {
                var records = from record in db.Pacjent_PAIs
                              where record.Nr_telefonu == nr_telefonu
                              select record;
                return records.ToList();
            }
        }
    }
}
